package IO流.序列化流;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;

public class 把对象读取到程序中 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        //1.创建反序列化流对象
        ObjectInputStream ois=new ObjectInputStream(new FileInputStream("F//c.txt"));

       //2.读取数据
        ArrayList<Student> list =(ArrayList<Student>)ois.readObject();

        //3.读取转换的列表
        for (Student student : list) {
            System.out.println(student);
        }

        //4.释放资源
        ois.close();
    }
}
